<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			body {
				background-color: orange;
			}

			.bg1 {
				background-color: orange;
			}

			.bg2 {
				background-color: green;
			}
		</style>
		<script type="text/javascript">
			var flag = false;

			function fn() {
				var body = document.body;
				if (flag) {
					// body.className = "bg1";
					body.style.backgroundColor = "orange"
					flag = false;
				} else {
					// body.className = "bg2";
					body.style.backgroundColor = "green"
					flag = true;
				}
			}
		</script>
	</head>
	<body>
		<button onclick="fn()">样式属性操作</button>
	</body>
</html>
